#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3

conn = sqlite3.connect('performance.db')
cursor = conn.cursor()

print('=== 检查空项目名称的数据 ===')
cursor.execute('SELECT DISTINCT statistics_period, project_name FROM project_worktime_stats WHERE project_name = "" OR project_name IS NULL ORDER BY statistics_period')
empty_projects = cursor.fetchall()
print('空项目名称的记录:')
for row in empty_projects:
    print(f'周期: {row[0]}, 项目: "{row[1]}"')

print(f'\n空项目名称记录数: {len(empty_projects)}')

print('\n=== 检查非空项目名称的数据 ===')
cursor.execute('SELECT DISTINCT statistics_period, project_name FROM project_worktime_stats WHERE project_name != "" AND project_name IS NOT NULL ORDER BY statistics_period, project_name LIMIT 10')
non_empty_projects = cursor.fetchall()
print('非空项目名称的记录:')
for row in non_empty_projects:
    print(f'周期: {row[0]}, 项目: "{row[1]}"')

conn.close()